#pragma once
#include "../config.h"
#include MUTEX_H

namespace Commands
{
    namespace Core
    {
        template < class MUTEX = MUTEXTYPE >
        /** \brief */
        class Lockable
        {
        public:
            class Lock
            {
                public:
                    /** \brief */
                    Lock(const Mutex& mutex)
                    : mutex(mutex)
                    {
                        mutex.Acquire();
                    }

                    /** \brief */
                    ~Lock()
                    {
                        mutex.Release();
                    }
    
                private:
                    const Mutex& mutex;
            };

            /** \brief */
            Lockable()
            : mutex()
            {}

        protected:
            const MUTEX mutex;
        private:
            /** \brief */
            Lockable(const Lockable&);
            /** \brief */
            Lockable& operator=(const Lockable&);
        };
    }//Core
}//Commands
